//
//  QWHTTPDownloaderConfig.m
//  WJHTTPDownloader-example
//
//  Created by Yunhai.Wu on 16/1/8.
//  Copyright © 2016年 WJ. All rights reserved.
//

#import "QWHTTPDownloaderConfig.h"

@interface QWHTTPDownloaderConfig ()

@end

@implementation QWHTTPDownloaderConfig

-(void) singleInit {
    _defaultCacheDuration = 60*60*24*7;
}

-(void) setCacheObject:(id<IQWHTTPDownloadCache>) cacheObject {
    if (cacheObject) {
        _cache = cacheObject;
    }
}

-(void) setDefaultDuration:(NSTimeInterval) duration {
    if (duration >= 0) {
        _defaultCacheDuration = duration;
    }
}

- (id) copy {
    return self;
}
- (id) mutableCopy {
    return self;
}


+(instancetype) sharedInstance {
    
    static dispatch_once_t once;
    
    static id sharedObject;
    dispatch_once( &once, ^{
        sharedObject = [[self alloc] init];
        [sharedObject singleInit];
    });
    return sharedObject;
}

@end
